<div class="span12">
    <div class="box gradient">
        <div class="title" style="text-align: center">
            <h4>Historique Bon Livraison {{reference}}</h4>
        </div>
    </div>
</div>
<div class="span12"  style="margin-left:0">
    <div class="box">
        <div style="display: block;" class="content noPad">
            <table class="responsive table table-bordered">
                <thead>
                    <tr>
                        <th style="width:3%">N°</th>
                        <th style="width:15%">Date</th>
                        <th style="width:30%">Heure</th>
                        <th style="width:7%">Utilisateur</th>
                        <th style="width:10%">Departement</th>
                        <th style="width:5%">Client</th>
                        <th style="width:5%">Montant Ttc</th>
                        <th style="width:5%">Reste</th>
                        <th style="width:5%">Cloturé</th>
                        <th style="width:5%">Action</th>
                    </tr>
                </thead>
                <tbody>
                    {% set total_ttc = 0 %}
                    {% for i,history in histories %}
                        <tr>
                            <td>{{i+1}}</td>
                            <td>{{history.date|date('d/m/Y')}}</td>
                            <td>{{history.getTime}}</td>
                            <td>{{history.user}}</td>
                            <td>{{history.departement}}</td>
                            <td>{{history.client}}</td>
                            <td>{{history.montantTtc}}</td>
                            <td>{{history.reste}}</td>
                            {% if history.isCloturer %}
                                <td>OUI</td>
                            {% else %}
                                <td></td>
                            {% endif %}
                            <td>
                                <a class="tip" href="javascript:showHistoryBonLivraison('{{history.id}}')" title="Visualiser">
                                    <span class="icon12 icon-eye-open"></span>
                                </a>
                            </td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="span2" style="margin-right: 0">
        <table>
            <tr>
                <td><input style="width:100px" type="button" class="btn btn-info cut-icon-previous"  value="Retour" onclick="retourListeBonLivraison()"></td>
            </tr>
            <tr>
                <td style="height: 20px"></td>
            </tr>
            <tr>
                <td><input style="width: 100px" type="button" class="btn btn-info cut-icon-previous"  value="Imprimer" onclick=""></td>
            </tr>
        </table>
    </div>

    <script>
                    function retourListeBonLivraison() {
                        $.ajax({
                            url: "{{ path('gds_vente_liste_bon_livraison') }}",
                            data: 'retour=true' + '&numero=' + lf[0] + '&client=' + lf[1] + '&date1=' + lf[2] + '&date2=' + lf[3] + '&heure1=' + lf[4] + '&heure2=' + lf[5]
                                    + '&reference=' + lf[6] + '&designation=' + lf[7] + '&ttc1=' + lf[8] + '&ttc2=' + lf[9] + '&is_cloture=' + lf[10]
                                    + '&reglement=' + lf[11] + '&departement=' + lf[12],
                            success: function(data) {
                                $('#div_liste_bon_livraison').replaceWith(data)
                                $('#filtre_numero').val(lf[0])
                                $('#client').val(lf[1])
                                $('#filtre_date1').val(lf[2])
                                $('#filtre_date2').val(lf[3])
                                $('#filtre_reference').val(lf[6])
                                $('#filtre_designation').val(lf[7])
                                $('#filtre_ttc1').val(lf[8])
                                $('#filtre_ttc2').val(lf[9])
                                $('#filtre_type').val(lf[10])
                                $('#filtre_reglement').val(lf[11])
                                $('#departement').val(lf[12])
                            }
                        })
                    }
                    function showHistoryBonLivraison(id){
                        $.ajax({
                            url: '{{path('gds_vente_bon_livraison_historique_show')}}',
                            data: 'id=' + id,
                            success: function(data) {
                                $('#div_liste_bon_livraison').html(data)
                            }
                        })
                    }
        </script>
